#include <stdio.h>

//lapacke headers
#include "lapacke.h"
#include "lapacke_config.h"
#include "lapacke_utils.h"

extern lapack_int LAPACKE_dgeev( int matrix_order, char jobvl, char jobvr,
                          lapack_int n, double* a, lapack_int lda, double* wr,
                          double* wi, double* vl, lapack_int ldvl, double* vr,
                          lapack_int ldvr );

int main(){
    int matrix_order = LAPACK_COL_MAJOR;
    FILE* fptr;
    int i,j;
    char jobvl = 'N';
    char jobvr = 'V';
    int n = 50;
    double A[2500] = {0};
    int lda = n;
    double wr[50] = {0};
    for (i=0;i<n;i++){
        A[i*n+i] = 2;
        if (i<n-1){
            A[i*n+i+1] = 1;
            A[(i+1)*n + i];
        } 
    }
    fprt = fopen("eig.csv");
    int info = LAPACKE_dgeev(matrix_order,jobvl,jobvr,n,A,lda,wr);
    if(info==0){
        int i = 0;
        int j = 0;
        for(i=0;i<n;i++){
            fprintf(fptr,"%.7g\n",wr[i]);
        }
        printf("SUCCESS\n");
    }

    return 0;
}